package vtt.android.dapanhc.adapters;

import java.util.List;

import vtt.android.dapanhc.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ChallengeDateAdapter extends ArrayAdapter<String> {

	private Context context;
	private List<String> items;

	public ChallengeDateAdapter(Context context, List<String> items) {
		super(context, 0, items);
		this.context = context;
		this.items = items;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view = convertView;
		if (view == null) {
			LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			view = layoutInflater.inflate(R.layout.row_listening_date, null);
			Holder holder = new Holder();
			holder.name = (TextView) view.findViewById(R.id.tvDate);
			view.setTag(holder);
		}
		Holder holder = (Holder) view.getTag();
		holder.name.setText(items.get(position));
		return view;
	}

	static class Holder {
		TextView name;
		ImageView iconLeft;
	}

}
